<?php
/**
 * Data model
 *
 * @category  DataModel
 * @package   DataModel
 * @author    DataModel Generator v1.3
 * @version   Revision: $Rev$
 */
/**
 * Data model for table "phpdoc_class"
 *
 * @category  DataModel
 * @package   DataModel
 * @author    DataModel Generator v1.3
 * @version   Revision: $Rev$
 *
 * @property-read mixed Id
 * @property-read mixed FileId
 * @property-read mixed Name
 * @property-read mixed BuildId
 * @property-read mixed New
 * @property-read mixed StartLine
 * @property-read mixed EndLine
 * @property-read mixed IsInterface
 * @property-read mixed IsAbstract
 * @property-read mixed Extends
 * @property-read mixed Implements
 * @property-read mixed PackageId
 * @property-read mixed ShortDescription
 * @property-read mixed Version
 * @property-read mixed Copyright
 * @property-read mixed Description
 */
abstract class BasePhpdocClass extends BaseRecord
{
    const TABLE_NAME = "phpdoc_class";

    public function __construct()
    {
        parent::__construct(self::TABLE_NAME);
    }

    protected function initFields()
    {
        $this->hasColumn('id', 'PUA:int(10)');
        $this->hasColumn('file_id', 'UN:int(10)');
        $this->hasColumn('name', 'varchar(255)');
        $this->hasColumn('build_id', 'U:int(10)');
        $this->hasColumn('new', 'tinyint(1)');
        $this->hasColumn('start_line', 'N:int(10)');
        $this->hasColumn('end_line', 'N:int(10)');
        $this->hasColumn('is_interface', 'UN:tinyint(1)');
        $this->hasColumn('is_abstract', 'UN:tinyint(1)');
        $this->hasColumn('extends', 'N:varchar(255)');
        $this->hasColumn('implements', 'N:varchar(255)');
        $this->hasColumn('package_id', 'UN:int(10)');
        $this->hasColumn('short_description', 'N:text');
        $this->hasColumn('version', 'N:varchar(255)');
        $this->hasColumn('copyright', 'N:varchar(255)');
        $this->hasColumn('description', 'N:mediumtext');
    }

    public function initRelations()
    {
        $this->addRelation('PhpdocClassRefClass', new ORMRelationOne2Many('PhpdocClassRefClass','id','class_id'));
        $this->addRelation('PhpDocPackage', new ORMRelationOne2One('PhpDocPackage','package_id','id'));
        $this->addRelation('PhpDocMethods', new ORMRelationOne2Many('PhpDocMethod','id','class_id'));
        $this->addRelation('PhpDocInheritedMethods', new ORMRelationOne2Many('PhpDocInheritedMethods','id','class_id'));
        $this->addRelation('PhpdocVariables', new ORMRelationOne2Many('PhpdocVariable','id','class_id'));
        $this->addRelation('PhpdocConsts', new ORMRelationOne2Many('PhpdocConst','id','class_id'));
        $this->addRelation('PhpdocTag', new ORMRelationMany2Many('PhpdocTag','class_id','PhpdocTagRefClass','tag_id'));
        $this->addRelation('PhpdocFile', new ORMRelationOne2One('PhpdocFile','file_id','id'));    
    }

    public function getById($id)
    {
        return parent::getById($id, 'PhpdocClass');
    }

    public function getByParams( $params, $type = ORMRecord::ONE_RECORD, $limit = null )
    {
        return parent::getByParams( $params, $type, $limit, 'PhpdocClass');
    }

    public function getAll( $limit = null )
    {
        return parent::getAll( $limit, 'PhpdocClass' );
    }
}